package WTE;

import java.util.Scanner;

public class Demo_02 {
    public static void main(String[] args) {
        method2();
    }

    /**
     * 排序子序列
     * https://www.nowcoder.com/questionTerminal/2d3f6ddd82da445d804c95db22dcc471
     * 未过 理解
     */
    public static void method1(){
        // 准备工作 接收数据封装数组
        Scanner in = new Scanner(System.in);
        int length = in.nextInt();
        int[] arr = new int[length];
        for (int i = 0; i < length; i++) {
            arr[i] = in.nextInt();
        }

        int sum = 1;
        /**
         * flag 标志位 三个状态 0表示未知 1表示增 -1表示减
         */
        int flag = 0;
        for (int i = 1; i < length; i++) {
            if(arr[i] > arr[i - 1]){
                if(flag == 0){
                    flag = 1;
                }
                if(flag == -1){
                    flag = 0;
                    sum++;
                }
            }
            if(arr[i] < arr[i-1]){
                if(flag == 0){
                    flag = -1;
                }
                if(flag == 1){
                    flag = 0;
                    sum++;
                }
            }
        }
        System.out.println(sum);
    }

    /**
     * 倒置字符串: 一句话的单词倒置,标点不倒置
     * 思路1: split分割 双指针交换 一遍过
     */
    public static void method2() {
        Scanner in = new Scanner(System.in);
        String str = in.nextLine();

        String[] s = str.split(" ");
        int begin = 0;
        int end = s.length-1;

        while(begin < end){
            String temp = s[begin];
            s[begin] = s[end];
            s[end] = temp;
            begin++;
            end--;
        }

        str = "";
        for (int i = 0; i < s.length; i++) {
            if(i == s.length - 1){
                str = str + s[i];
                break;
            }
            str +=s[i]+" ";
        }

        System.out.println(str);
    }
}
